package model.dao;

import java.sql.ResultSet;
import java.util.ArrayList;

import model.pojo.ChiTietHoaDon;
import model.util.DataHelper;

public class ChiTietHoaDonDAO {
	
	public static boolean ThemChiTietHoaDon(ChiTietHoaDon ct)
    {
        boolean kq =false;
        DataHelper helper = new DataHelper();
        try
        {
            
            helper.open();
            ArrayList<Object> para = new ArrayList<Object>();
            para.add(ct.getMaHD());
            para.add(ct.getMaSP());
            para.add(ct.getSoLuong());
            
            int sl= helper.executeInsProcedure("{call sp_InsertChiTietHoaDon(?,?,?)}", para);
            if(sl>0)
            {
            	kq=true;
            }           
            //helper.close();
        }
        catch(Exception ex)
        {
            System.out.println(ex.getMessage());
        }
        finally
        {
        	//kq=false;
            helper.close();
        }
        return kq;
    }
}
